// -----------------------------------------------------------------------
// <copyright file="CachedItem.cs" company="Softserve">
// Class for cache item
// </copyright>
// -----------------------------------------------------------------------
namespace WebServer.BusinessLogic.Web.Cache
{
    using System;

    /// <summary>
    /// Class for cache item
    /// </summary>
    public class CachedItem
    {
        /// <summary>
        /// Fielf for cache data
        /// </summary>
        private byte[] data;

        /// <summary>
        /// Initializes a new instance of the <see cref="CachedItem" /> class.
        /// </summary>
        /// <param name="value">cache data</param>
        public CachedItem(byte[] value)
        {
            this.Data = value;
        }

        /// <summary>
        /// Gets or sets cache data
        /// </summary>
        public byte[] Data
        {
            get
            {
                return this.data;
            }

            set
            {
                this.DataSize = value.Length;
                this.data = value;
            }
        }

        /// <summary>
        /// Gets Size of data
        /// </summary>
        public long DataSize { get; private set; }

        /// <summary>
        /// Gets or sets time access
        /// </summary>
        public int AccessedTimes { get; set; }

        /// <summary>
        /// Gets or sets time of last acess
        /// </summary>
        public DateTime LastAccessTime { get; set; }

        /// <summary>
        /// Gets or sets time creation
        /// </summary>
        public DateTime CreationTime { get; set; }
    }
}